import React from "react";


class Header extends React.Component{

    constructor(props){
        super(props);
        this.state={
            title:'',
        }
    }
    componentWillMount(){
        this.setState({
            title:this.props.title
        })
    }
    render(){
        return(
            <div>
               <div>{this.state.title}</div>
                <button onClick={()=>{
                    this.props.sendMessage("我是子组件传递给父组件的数据")
                }}>点击</button>
            </div>
        )
    }
}

export default Header;